package com.huilian.iotbox.mqtt.server.base.service.impl;

import com.huilian.iotbox.data.po.DeviceOnlineOfflineRecord;
import com.huilian.iotbox.mqtt.server.base.dao.DeviceOnlineOfflineRecordDao;
import com.huilian.iotbox.mqtt.server.base.service.DeviceOnlineOfflineRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class DeviceOnlineOfflineRecordServiceImpl implements DeviceOnlineOfflineRecordService {

    @Autowired
    private DeviceOnlineOfflineRecordDao deviceOnlineOfflineRecordDao;

    @Override
    public DeviceOnlineOfflineRecord findOneStartTime(Integer deviceId, Integer type, Date time) {
        return deviceOnlineOfflineRecordDao.findOneStartTime(deviceId, type, time);
    }

    @Override
    public int insert(DeviceOnlineOfflineRecord deviceOnlineOfflineRecord) {
        return deviceOnlineOfflineRecordDao.insert(deviceOnlineOfflineRecord);
    }

    @Override
    public int update(DeviceOnlineOfflineRecord updateDOORecord) {
        return deviceOnlineOfflineRecordDao.update(updateDOORecord);
    }

    @Override
    public DeviceOnlineOfflineRecord findOneRecentlyOnlineRecord(Integer deviceId, Integer type, Date startTime) {
        return deviceOnlineOfflineRecordDao.findOneRecentlyOnlineRecord(deviceId, type, startTime);
    }

    @Override
    public int deleteById(Long id) {
        return deviceOnlineOfflineRecordDao.deleteById(id);
    }
}
